var app = new Vue({
    el: '#orderlist',
    data: {
        status: 0,
        currentPage: 1,
        limit: 5,
        list: [],
        listli:[],
        dataCount:0
    },
    methods: {
        filterList(idx) {
            this.status = idx
            this.currentPage = 1
            this.getalldata()
        },
        getalldata() {
            var data = new URLSearchParams()
            if (this.status !== 0) {
                data.append('status', this.status)
            }
            data.append('page', this.currentPage)
            data.append('pagesize', this.limit)
            axios.post('user.php?act=order_list&ajax=true', data).then(e => {
                console.log(e)
                this.list = e.data.list
                this.dataCount = parseInt(e.data.total)
            })
        },
        handleCurrentChange(page) {
            this.currentPage = page
            this.getalldata()
        },
        init() {
            this.getalldata()
        }
    },
    created() {
        this.init()
    },
    filters: {
        capitalize: v => {
            console.log(v)
            switch (parseInt(v)) {
                case -1:
                    return '已取消'
                case 1:
                    return '待支付'
                case 2:
                    return '待发货'
                case 3:
                    return '待收货'
                case 4:
                    return '已完成'
                case -2:
                    return '已删除'
            }
        }
    }
})